﻿<UserControl x:Class="WellDone.FloorLayout" 
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  
           mc:Ignorable="d"
           xmlns:LayoutManager="clr-namespace:FloorDesigner;assembly=FloorDesigner"  
           xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
           xmlns:local="clr-namespace:WellDone" d:DesignHeight="449"
     xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           Background="Red" Width="1141" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" 
             xmlns:rulerctrl="clr-namespace:WellDone"
             >

    <UserControl.Resources>
        <!-- Style for drag and drop control -->
        <Style x:Key="RectangleStyle" TargetType="LayoutManager:TableControl">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="LayoutManager:TableControl">
                        <Grid x:Name="LayoutRoot" Background="{TemplateBinding Background}">
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualState x:Name="Normal">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                                                           Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="rectangle" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" 
                                                                      Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                                                           Storyboard.TargetName="rectangle" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0.5"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames 
                                                BeginTime="00:00:00" 
                                                Storyboard.TargetName="rectangle" 
                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames 
                                                BeginTime="00:00:00" 
                                                Storyboard.TargetName="rectangle" 
                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                                                           Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="rectangle" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="DraggingStates">
                                    <vsm:VisualState x:Name="DragStarted">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="LayoutRoot" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.495"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Dropped">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="LayoutRoot" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="SurfaceStates">
                                    <vsm:VisualState x:Name="SurfaceEnter">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                                                           Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="rectangle" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.5"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="SurfaceLeave">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                                                           Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="rectangle" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>
                            <Border 
							    BorderBrush="{TemplateBinding BorderBrush}" 
							    BorderThickness="{TemplateBinding BorderThickness}">
                                <ContentPresenter 
								    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
								    Margin="{TemplateBinding Padding}" x:Name="contentPresenter" 
								    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
								    Content="{TemplateBinding Content}" 
								    ContentTemplate="{TemplateBinding ContentTemplate}"/>
                            </Border>
                            <Rectangle Margin="0,0,0,0" Stroke="#FF000000" x:Name="rectangle" Opacity="0">
                                <Rectangle.Fill>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FF000000"/>
                                        <GradientStop Color="#FFFFFFFF" Offset="1"/>
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <Border>
                                <Image x:Name="imgdrag" Cursor="Hand" Source="/WellDoneBackOffice;component/Images/icon_drag_drop.png" Width="19" Height="19" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Visible"  ToolTipService.ToolTip="Drag and drop table"/>
                            </Border>
                            <Border>
                                <TextBlock x:Name="tableID"  Text="0" HorizontalAlignment="Center" VerticalAlignment="Top"  Foreground="White"></TextBlock>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="EllipseStyle" TargetType="LayoutManager:TableControl">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="LayoutManager:TableControl">
                        <Grid x:Name="EllipseLayoutRoot" Background="{TemplateBinding Background}">
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualState x:Name="Normal">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                                                           Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="Ellipse" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" 
                                                                      Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                                                           Storyboard.TargetName="Ellipse" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0.5"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames 
                                                BeginTime="00:00:00" 
                                                Storyboard.TargetName="Ellipse" 
                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames 
                                                BeginTime="00:00:00" 
                                                Storyboard.TargetName="Ellipse" 
                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                                                           Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="Ellipse" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="DraggingStates">
                                    <vsm:VisualState x:Name="DragStarted">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="EllipseLayoutRoot" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.495"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Dropped">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="EllipseLayoutRoot" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="SurfaceStates">
                                    <vsm:VisualState x:Name="SurfaceEnter">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                                                           Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="Ellipse" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.5"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="SurfaceLeave">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                                                           Duration="00:00:00.0010000" 
                                                                           Storyboard.TargetName="Ellipse" 
                                                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>
                            <Ellipse Margin="0,0,0,0" Stroke="#FF000000" x:Name="Ellipse" Opacity="0">
                                <Ellipse.Fill>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FF000000"/>
                                        <GradientStop Color="#FFFFFFFF" Offset="1"/>
                                    </LinearGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Border>
                                <Image x:Name="imgdrag" Cursor="Hand" Source="/WellDoneBackOffice;component/Images/icon_drag_drop.png" Width="19" Height="19" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Visible"  ToolTipService.ToolTip="Drag and drop table"/>
                            </Border>
                            <Border>
                                <TextBlock x:Name="tableID"  Text="0" HorizontalAlignment="Center" VerticalAlignment="Top"  Foreground="White"></TextBlock>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="Button" x:Key="btnstyle">
            <Setter Property="Background" Value="Red"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid>
                            <ContentPresenter>
                                <Path x:Name="BtnArrow" Height="9" Width="9" Stretch="Fill" 
                                      Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z " 
                                          Margin="0,0,6,0" HorizontalAlignment="Right">
                                    <Path.Fill>
                                        <SolidColorBrush x:Name="BtnArrowColor" Color="Red"/>
                                    </Path.Fill>
                                    <Path.RenderTransform>
                                        <ScaleTransform x:Name="Scale" />
                                    </Path.RenderTransform>
                                </Path>
                            </ContentPresenter>


                        </Grid>

                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="MyWhiteText" TargetType="sdk:Label">
            <Setter Property="Foreground" Value="{StaticResource WhiteBrush}"/>
        </Style>
        <Style x:Key="XYPoint" TargetType="sdk:Label">
            <Setter Property="Foreground" Value="Blue"/>
            <Setter Property="FontWeight" Value="Bold" />
        </Style>
        <Style TargetType="Thumb" x:Key="MyThumbStyle">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Thumb">
                        <Image x:Name="imgResize"
                   Margin="1"
                   Opacity="1"
                   Cursor="SizeNWSE"  ToolTipService.ToolTip="Resize table" ImageFailed="Image_ImageFailed" Source="/WellDoneBackOffice;component/Images/Resizer.png" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="#FFC5C2BF" HorizontalAlignment="Left" Width="1141" >
        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="218"></ColumnDefinition>
            <ColumnDefinition Width="0"/>
            <ColumnDefinition Width="1003"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Row="0" Grid.Column="0" Width="1143" Margin="-2,0,0,6" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.523" Grid.ColumnSpan="3" >
            <Grid.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0"/>
                    <GradientStop Color="White" Offset="1"/>
                </LinearGradientBrush>
            </Grid.Background>
            <Grid.RowDefinitions>
                <RowDefinition Height="50"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="163"/>
                <ColumnDefinition Width="40"/>
                <ColumnDefinition Width="40"/>
                <ColumnDefinition Width="40"/>
                <ColumnDefinition Width="40"/>
                <ColumnDefinition Width="11"/>
            </Grid.ColumnDefinitions>

            <sdk:Label  x:Name="lblHeader"  Content="" Grid.Row="0" VerticalAlignment="Center" Margin="22,12,340,12" Height="19" FontWeight="Bold"  Style="{StaticResource MyWhiteText}" >

            </sdk:Label>

            <sdk:Label Content="Layout Name " Grid.Row="0" VerticalAlignment="Center" Margin="620,12,10,12" Height="21" HorizontalAlignment="Right"  Style="{StaticResource MyWhiteText}" />

            <ComboBox x:Name="ddlLayout"  Height="25" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="157" Margin="0,13,0,12" SelectionChanged="ddlLayout_SelectionChanged" SelectedValuePath="Tag"  HorizontalContentAlignment="Left" Grid.Column="1"/>

            <Button x:Name="btnaddtableLayout" Grid.Column="2"  Grid.Row="0"  Click="addtableLayout_Click" Margin="5,12,5,12" ToolTipService.ToolTip="Add a new layout" >
                <StackPanel Orientation="Horizontal">
                    <Image Source="/WellDoneBackOffice;component/Images/Add.png"  Width="15" Height="11" Margin="0"/>
                </StackPanel>
            </Button>

            <Button x:Name="btnEdittableLayout" Grid.Column="3"  Grid.Row="0"  Click="btnEdittableLayout_Click" Margin="5,12,5,12" ToolTipService.ToolTip="Edit layout">
                <StackPanel Orientation="Horizontal">
                    <Image Source="/WellDoneBackOffice;component/Images/edit.png"  Width="15" Height="11" Margin="0"/>
                </StackPanel>
            </Button>

            <Button x:Name="btnDeletetableLayout" Grid.Column="4"  Grid.Row="0"  Click="btnDeletetableLayout_Click" Margin="5,12,5,12"  ToolTipService.ToolTip="Delete layout">
                <StackPanel Orientation="Horizontal">
                    <Image Source="/WellDoneBackOffice;component/Images/Delete.png"  Width="15" Height="11" Margin="0" />
                </StackPanel>
            </Button>

            <Button x:Name="btnPreviewLayout" Grid.Column="5"  Grid.Row="0"  Click="btnPreviewLayout_Click" Margin="5,12,5,12"  ToolTipService.ToolTip="Preview layout">
                <StackPanel Orientation="Horizontal">
                    <Image Source="/WellDoneBackOffice;component/Images/Preview.png"  Width="15" Height="11" Margin="0" />
                </StackPanel>
            </Button>


        </Grid>

        <Grid Grid.Row="1" Grid.Column="0" Width="218" Background="#FFC5C2BF" HorizontalAlignment="Center" Margin="2" >
            <Grid.RowDefinitions>
                <RowDefinition Height="30" />
                <RowDefinition Height="80"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="25"/>
                <RowDefinition Height="25"/>
                <RowDefinition Height="25"/>
                <RowDefinition Height="25"/>
                <RowDefinition Height="25"/>
                <RowDefinition Height="25"/>
                <RowDefinition Height="25"/>
                <RowDefinition Height="25"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="118" />
                <ColumnDefinition Width="100"/>
            </Grid.ColumnDefinitions>

            <StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" Background="#FFFDFDFD" Height="21" Grid.ColumnSpan="2" Margin="4,4,2,2" Grid.Row="0" >
                <Grid x:Name="gridvertical" >
                    <Border BorderThickness="2" BorderBrush="Gray"></Border>
                    <sdk:Label Content="ToolBox" FontSize="15" HorizontalAlignment="Center" Grid.ColumnSpan="2" Margin="0" Width="208" Grid.Row="0" VerticalAlignment="Center"/>
                </Grid>
            </StackPanel>

            <StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" Background="Gray" Height="80" Grid.ColumnSpan="2" Margin="0" Grid.Row="1" >
                <Grid x:Name="gridToolBox">
                    <LayoutManager:TableControl BorderBrush="#FF000000" Foreground="#FF3E72D5" Height="50" IsRactangle="True"
                                                    Width="100" BorderThickness="2,2,2,2" 
                                                    Style="{StaticResource RectangleStyle}" 
                                                    x:Name="Ractangle" VerticalAlignment="Bottom" AllowCopy="True" 
                                                    OnceCopy="True" Padding="2,2,2,2"                                                 
                                                    Content="" Margin="96,0,22,-61" >
                        <LayoutManager:TableControl.Background>
                            <RadialGradientBrush>
                                <GradientStop Color="#FF3E72D5"  />
                                <GradientStop Color="#FF3E72D5" Offset="1"/>
                            </RadialGradientBrush>
                        </LayoutManager:TableControl.Background>
                    </LayoutManager:TableControl>
                    <LayoutManager:TableControl BorderBrush="Black" Foreground="Black" Height="50"  IsRactangle="False"
                                                    Width="50" BorderThickness="2,2,2,2" 
                                                    Style="{StaticResource EllipseStyle}" 
                                                    x:Name="Ellipse" VerticalAlignment="Bottom" AllowCopy="True" 
                                                    OnceCopy="True" Padding="2,2,2,2"                                                  
                                                    Content="" Margin="10,0,130,-61" >
                        <LayoutManager:TableControl.Background>
                            <RadialGradientBrush>
                                <GradientStop Color="#FF3E72D5" Offset=".90"/>
                                <GradientStop Color="Black" Offset="1"/>
                                <GradientStop Color="Transparent" Offset="1"/>
                            </RadialGradientBrush>

                        </LayoutManager:TableControl.Background>
                    </LayoutManager:TableControl>
                </Grid>
            </StackPanel>


            <StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" Background="#FFFDFDFD" Height="21" Grid.ColumnSpan="2" Margin="4,4,2,2" Grid.Row="2" >
                <Grid x:Name="GridProperties">
                    <Border BorderThickness="2" BorderBrush="Gray"></Border>
                    <sdk:Label Content="Properties" FontSize="15" HorizontalAlignment="Center" Grid.ColumnSpan="2" Margin="0" Width="101" Grid.Row="2" VerticalAlignment="Center"/>
                </Grid>
            </StackPanel>
            <sdk:Label Content="Table Number"   Grid.Row="3"  HorizontalAlignment="Left" VerticalAlignment="Center" Margin="3" Width="107"/>
            <TextBox x:Name="txtTableNumber"  Text="" Grid.Row="3" Grid.Column="1"  Height="25"  VerticalAlignment="Center" HorizontalAlignment="Left" Width="95" Margin="3,0,0,0" Grid.ColumnSpan="2" TextAlignment="Right" KeyUp="txtTableNumber_KeyUp" TextChanged="txtTableNumber_TextChanged" KeyDown="txtTableNumber_KeyDown" />



            <sdk:Label Content ="Width" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3" Width="55"/>
            <TextBox x:Name="txtWidth" Text="" Grid.Column="1"  Height="25" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3,0,0,0" Width="95" TextChanged="txtLength_TextChanged" KeyDown="txtLength_KeyDown" TextAlignment="Right" KeyUp="txtWidth_KeyUp"/>

            <sdk:Label Content="Height" Grid.Row="5" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Left"  Width="48"/>
            <TextBox x:Name="txtHeight" Text="" Grid.Row="5"  Height="25" Margin="3,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="95" Grid.Column="1" RenderTransformOrigin="-0.738,0.313" TextChanged="txtwidth_TextChanged" KeyDown="txtwidth_KeyDown" TextAlignment="Right" KeyUp="txtHeight_KeyUp"/>

            <sdk:Label Content="Rotation" Grid.Row="6" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Left"  Width="66"/>
            <TextBox  x:Name="txtRotation" Text="" Grid.Column="1" Grid.Row="6" Height="25" VerticalAlignment="Center" HorizontalAlignment="Left" Width="95" Margin="3,0,0,0" TextAlignment="Right" />

            <sdk:Label Content="CenterX" Grid.Row="7" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Left" Width="63"/>
            <TextBox  x:Name="txtclientX"   Text=""  TextWrapping="Wrap" Height="25" Grid.Row="7" Margin="3,0,0,0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Width="95" KeyDown="txtclientX_KeyDown" TextChanged="txtclientX_TextChanged" TextAlignment="Right"  KeyUp="txtclientX_KeyUp" />

            <sdk:Label Content="CenterY" Grid.Row="8" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Left"  Width="63" RenderTransformOrigin="0.542,-3.594"/>
            <TextBox x:Name="txtclientY" Text=""  TextWrapping="Wrap" Height="25" Grid.Row="8" Margin="3,0,0,0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Width="95" KeyDown="txtclientY_KeyDown" TextChanged="txtclientY_TextChanged" TextAlignment="Right" KeyUp="txtclientY_KeyUp" />

            <sdk:Label Content="Rectangle" Grid.Row="9" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Left"  Width="88"/>
            <CheckBox x:Name="chkRactangle" Grid.Row="9" Grid.Column="1" Margin="3" IsTabStop="False" IsEnabled="False"/>
            <Button x:Name="imgDelete" Click="Thumb_Click" Grid.Row="10" Grid.Column="1" Height="21" Margin="3"  VerticalAlignment="Center" Width="22" HorizontalAlignment="Left" >
                <Image Cursor="Hand"  HorizontalAlignment="Left"  Source="/WellDoneBackOffice;component/Images/Delete.png" ToolTipService.ToolTip="Delete table" />
            </Button>
        </Grid>


        <ScrollViewer Grid.Row="1" Grid.Column="2" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="4,5,0,0" HorizontalAlignment="Left" Width="919" Height="390" MouseMove="ScrollViewer_MouseMove" >
            <Grid Width="909" x:Name="ScrollGrid" Height="541" Background="#FFFFFF"  HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" MouseLeftButtonDown="LayoutGrid_MouseLeftButtonDown">
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Grid x:Name="LayoutRulerHorizontal" Background="White" Width="860" Grid.Row="0" Grid.Column="1" Margin="0,0,0,0" HorizontalAlignment="Left" >
                    <Canvas Height="30"  Name="CanvasHorizontal" Background="White" VerticalAlignment="Top"  Width="860" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" >
                        <rulerctrl:RulerControl Height="30" VerticalAlignment="Top" x:Name="HorizontalRuler"  IsVertical="false"/>
                        <Button Height="18" Width="20" Canvas.Left="61" Canvas.Top="15" x:Name="btnHorizontal" Content="F" Style="{StaticResource btnstyle }">
                            <Button.RenderTransform>
                                <RotateTransform Angle="360"></RotateTransform>
                            </Button.RenderTransform>
                        </Button>
                    </Canvas>
                </Grid>
                <Grid x:Name="LayoutRulerVertical" Background="White" Height="541" Grid.Row="1" Grid.Column="0" Margin="0,-5,0,0" HorizontalAlignment="Left" >
                    <Canvas Height="541"  Name="canvasVertical" Background="White" VerticalAlignment="Top"  Width="30" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" >
                        <rulerctrl:RulerControl Width="30" HorizontalAlignment="Right" x:Name="RulerVertical"  IsVertical="true"/>
                        <Button Height="18" Width="20" Canvas.Left="15" Canvas.Top="15" x:Name="btnVertical" Content="F" Style="{StaticResource btnstyle }" >
                            <Button.RenderTransform>
                                <RotateTransform Angle="270"></RotateTransform>
                            </Button.RenderTransform>
                        </Button>
                    </Canvas>
                </Grid>


                <Grid  x:Name="LayoutGrid"  Width="860" Height="541" Background="#FFC5C2BF" Grid.Column="1" Grid.Row="1"  HorizontalAlignment="Left" Margin="0,0,0,0" ShowGridLines="True"  VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" MouseLeftButtonDown="LayoutGrid_MouseLeftButtonDown" Grid.RowSpan="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="11*" />
                        <RowDefinition Height="43*"/>
                        <RowDefinition Height="54*" />
                        <RowDefinition Height="54*" />
                        <RowDefinition Height="54*" />
                        <RowDefinition Height="54*" />
                        <RowDefinition Height="54*" />
                        <RowDefinition Height="54*" />
                        <RowDefinition Height="54*" />
                        <RowDefinition Height="55*" />
                        <RowDefinition Height="54*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <Canvas x:Name="LayoutContainer"  Width="731" Height="511" HorizontalAlignment="Left"  Grid.Column="0" Grid.Row="0"  Grid.ColumnSpan="9"  Grid.RowSpan="11"  VerticalAlignment="Top"/>
                </Grid>
            </Grid>
        </ScrollViewer>
    </Grid>
</UserControl>
